@@ -364,6 +364,10 @@ def mqtt_upload_temperature(payload): |
||
364 | 364 |
except IsolationPointInfo.DoesNotExist: |
365 | 365 |
return |
366 | 366 |
|
367 |
+ # 非配置的隔离点上报时间内 |
|
368 |
+ if not point.match_upload_period: |
|
369 |
+ return |
|
370 |
+ |
|
367 | 371 |
ThermometerMeasureLogInfo.objects.create(point_id=eqpt.point_id, macid=macid, start_stamp=start_stamp, end_stamp=end_stamp, temperature=temperature, temperature_src=ThermometerMeasureLogInfo.MQTT, chg_sta=chg_sta, ignore_temperature=ignore_temperature, ignore_fever_temperature=ignore_fever_temperature, upload_temperature_info=payload) |
368 | 372 |
|
369 | 373 |
try: |
@@ -12,7 +12,7 @@ class IsolationPointFieldPoolInfoAdmin(admin.ModelAdmin): |
||
12 | 12 |
|
13 | 13 |
|
14 | 14 |
class IsolationPointInfoAdmin(admin.ModelAdmin): |
15 |
- list_display = ('point_id', 'point_name', 'point_fields', 'limit_scene_qrcode_url', 'status', 'created_at', 'updated_at') |
|
15 |
+ list_display = ('point_id', 'point_name', 'point_fields', 'point_upload_period', 'limit_scene_qrcode_url', 'status', 'created_at', 'updated_at') |
|
16 | 16 |
|
17 | 17 |
|
18 | 18 |
class IsolationPointUserInfoAdmin(admin.ModelAdmin): |
@@ -0,0 +1,24 @@ |
||
1 |
+# Generated by Django 3.2.7 on 2022-04-11 07:21 |
|
2 |
+ |
|
3 |
+from django.db import migrations |
|
4 |
+import jsonfield.fields |
|
5 |
+ |
|
6 |
+ |
|
7 |
+class Migration(migrations.Migration): |
|
8 |
+ |
|
9 |
+ dependencies = [ |
|
10 |
+ ('equipment', '0024_auto_20211122_1633'), |
|
11 |
+ ] |
|
12 |
+ |
|
13 |
+ operations = [ |
|
14 |
+ migrations.AddField( |
|
15 |
+ model_name='isolationpointinfo', |
|
16 |
+ name='point_upload_period', |
|
17 |
+ field=jsonfield.fields.JSONField(blank=True, default=[], help_text='隔离点上传时段', null=True, verbose_name='point_upload_period'), |
|
18 |
+ ), |
|
19 |
+ migrations.AlterField( |
|
20 |
+ model_name='isolationpointinfo', |
|
21 |
+ name='point_fields', |
|
22 |
+ field=jsonfield.fields.JSONField(blank=True, default=[], help_text='隔离点字段列表', null=True, verbose_name='point_fields'), |
|
23 |
+ ), |
|
24 |
+ ] |
@@ -57,7 +57,18 @@ class IsolationPointInfo(BaseModelMixin): |
||
57 | 57 |
# "name": "", |
58 | 58 |
# "options": ["男", "女"], # type=select |
59 | 59 |
# } |
60 |
- point_fields = JSONField(_('point_fields'), default=[], blank=True, null=True, help_text='字段列表') |
|
60 |
+ point_fields = JSONField(_('point_fields'), default=[], blank=True, null=True, help_text='隔离点字段列表') |
|
61 |
+ |
|
62 |
+ # [ |
|
63 |
+ # { |
|
64 |
+ # 'start': '', |
|
65 |
+ # 'end': '', |
|
66 |
+ # }, { |
|
67 |
+ # 'start': '', |
|
68 |
+ # 'end': '', |
|
69 |
+ # } |
|
70 |
+ # ] |
|
71 |
+ point_upload_period = JSONField(_('point_upload_period'), default=[], blank=True, null=True, help_text='隔离点上传时段') |
|
61 | 72 |
|
62 | 73 |
limit_scene_qrcode_url = models.CharField(_('limit_scene_qrcode_url'), max_length=255, blank=True, null=True, help_text='字段二维码') |
63 | 74 |
|
@@ -69,6 +80,19 @@ class IsolationPointInfo(BaseModelMixin): |
||
69 | 80 |
return self.pk |
70 | 81 |
|
71 | 82 |
@property |
83 |
+ def match_upload_period(self): |
|
84 |
+ if not self.point_upload_period: |
|
85 |
+ return True |
|
86 |
+ for period in self.point_upload_period: |
|
87 |
+ local_date_string = tc.local_date_string() |
|
88 |
+ start_dt = tc.string_to_datetime(f'{local_date_string} {period["start"]}', format='%Y-%m-%d %H:%M') |
|
89 |
+ end_dt = tc.string_to_datetime(f'{local_date_string} {period["end"]}', format='%Y-%m-%d %H:%M') |
|
90 |
+ current_dt = tc.make_naive(tc.local_datetime()) |
|
91 |
+ if start_dt < current_dt < end_dt: |
|
92 |
+ return True |
|
93 |
+ return False |
|
94 |
+ |
|
95 |
+ @property |
|
72 | 96 |
def data(self): |
73 | 97 |
qrcode_url = get_qrcode_url(self.point_id) |
74 | 98 |
return { |